package com.zhiqingchun.web.mail;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zhiqingchun.common.Page;
import com.zhiqingchun.dao.mail.IMailDao;
import com.zhiqingchun.pojo.MailDO;

@Controller
@RequestMapping("/inbox.html")
public class InboxController {

	@RequestMapping(method = RequestMethod.GET)
	public String inbox(ModelMap map, HttpServletRequest request, HttpServletResponse response,
			int id, Page page) {
		MailDO mailDO = new MailDO();
		mailDO.setTosb(String.valueOf(id));
		mailDO.setDirection(1);
		mailDO.setStatus(0);
		List<MailDO> list = mailDao.list(mailDO, page);
		map.addAttribute("list", list);
		return "mail/inbox";
	}
	
	@Autowired
	private IMailDao mailDao;

	public IMailDao getMailDao() {
		return mailDao;
	}

	public void setMailDao(IMailDao mailDao) {
		this.mailDao = mailDao;
	}
}
